package com.cbl.v.ssczs.view.fragment;


import android.graphics.Color;
import android.support.v4.app.Fragment;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.ListView;
import android.widget.TextView;

import com.cbl.v.ssczs.R;
import com.cbl.v.ssczs.mode.entity.WfBean;
import com.cbl.v.ssczs.view.adapter.WfListAdapter;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import butterknife.BindView;

/**
 * A simple {@link Fragment} subclass.
 */
public class WFFragment extends BaseFragment {
    @BindView(R.id.lv_wf)
    ListView lvWf;
    private List<WfBean> wfBeanList;
    private WfListAdapter wfAdapter;
    private List<String> keyList;
    private List<String> titleList;
    private List<Integer> iconList;

    @Override
    protected int getLayout() {
        return R.layout.fragment_wf;
    }

    @Override
    protected void initView(View view) {
        wfBeanList = new ArrayList<>();
        keyList = new ArrayList<>();
        titleList=new ArrayList<>();
        iconList = new ArrayList<>();
        wfAdapter = new WfListAdapter(getContext(), wfBeanList);
        lvWf.setAdapter(wfAdapter);
        initToolBar(view);
    }
    private void initToolBar(View view) {
        Toolbar toolBar = (Toolbar) view.findViewById(R.id.toolbar);
        TextView title_name = (TextView) view.findViewById(R.id.title_name);
        title_name.setText("玩法介绍");
        toolBar.setTitle("");
        toolBar.setTitleTextColor(Color.WHITE);
    }

    @Override
    protected void initData() {
        Collections.addAll(keyList, "ssc","bjsc", "ssq", "fc3d", "qlc", "dlt", "qxc", "pls", "plw",  "ks", "llx5");
        Collections.addAll(titleList,"时时彩", "北京赛车","双色球", "福彩3D", "七乐彩", "大乐透", "七星彩", "排列三", "排列五",  "快三", "11选5");
        Collections.addAll(iconList,
                R.mipmap.ic_ssc,
                R.mipmap.ic_bjsc,
                R.mipmap.ic_ssq,
                R.mipmap.ic_3d,
                R.mipmap.ic_qlc,
                R.mipmap.ic_dlt,
                R.mipmap.ic_qxc,
                R.mipmap.ic_pl3,
                R.mipmap.ic_pl5,
                R.mipmap.ic_ks,
                R.mipmap.ic_11x5);
        getData();
    }

    @Override
    protected void initListener() {

    }

    @Override
    protected void onMyOnclick(View view) {

    }

    private void getData() {
        for (int i = 0; i < titleList.size(); i++) {
            WfBean bean = new WfBean();
            bean.setTitle(titleList.get(i));
            bean.setIcon(iconList.get(i));
            bean.setStringKey(keyList.get(i));
            wfBeanList.add(bean);
        }
        wfAdapter.notifyDataSetChanged();
    }


}
